
/*ajax请求服务地址*/
// var global_service = "rest-api/";     //
// var metadata_service = global_service + "pscm-metadata/";     // 权限、备件   18082

// var procurement_service = global_service + "pscm-procurement/";   // 采购、计划   18083

// var iwm_service = global_service + "pscm-iwm/";   // 库存设置   18086


// import axios from 'axios'
import ElementUI from 'element-ui'
import Vue from 'vue'
import store from '../store/store'
Vue.use(ElementUI)
export default{
  install(Vue,options)
  {
    var vue=new Vue();
    // var global_service = "rest-api/";     //
    // var metadata_sales = global_service + "pscm-sales";     // b2c
    // var orderType=function(){
    //   return axios.get(metadata_sales+"/sales/getCommonEnums?enumKey=orderType");
    // }
    // var itemStatus=function(){
    //   return axios.get(metadata_sales+"/sales/getCommonEnums?enumKey=itemStatus");
    // }
    // var orderStatus=function(){
    //   return axios.get(metadata_sales+"/sales/getCommonEnums?enumKey=orderStatus");
    // }
    // var invoiceType=function(){
    //  return axios.get(metadata_sales+'/sales/getCommonEnums?enumKey=taxType')
    // }
    // var returnOrderStatus=function(){
    //   return axios.get(metadata_sales+'/sales/getCommonEnums?enumKey=returnOrderStatus')
    // }
    // var returnOrderType=function () {
    //   return axios.get(metadata_sales+'/sales/getCommonEnums?enumKey=returnOrderType')
    // }
    // var returnWayEnum=function () {
    //   return axios.get(metadata_sales+'/sales/getCommonEnums?enumKey=returnWayEnum')
    // }
    // var getDay=function(date){
    //   var arr=date.split('-');     //日期为输入日期，格式为 2013-3-10 返回周几
    //   var dateFormat=new Date(arr[0],parseInt(arr[1]-1),arr[2]);
    //   var week;
    //   switch (dateFormat.getDay()) {
    //     case 0:week="周天";break
    //     case 1:week="周一";break
    //     case 2:week="周二";break
    //     case 3:week="周三";break
    //     case 4:week="周四";break
    //     case 5:week="周五";break
    //     case 6:week="周六";break
    //   }
    //   return week;
    // }
    //表单格式验证出错统一信息提示
    var formErrorInfo=function(){
      var err=store.state.languageType=="zh"?'输入项存在必填项未填写、格式不正确、与限制规则不符的情况，请按界面详细提示修改！':'Input are required not to fill out, not in the correct format, and limit the rules inconsistent, please click the interface with prompt modification!';
      return err;
    }
    var successTip=function(p) {     //成功时的提示信息
      vue.$notify({
        title: '成功',
        message: p,
        type: 'success'
      });
    }

    var errorTip=function(p) {     //错误提示
      vue.$notify.error({
        title: '错误',
        message: p
      });
    }
    var common={
    //   orderType:orderType,//订单类型
    //   itemStatus:itemStatus,//单行订单状态
    //   orderStatus:orderStatus,//订单状态
    //   invoiceType:invoiceType,//获取发票类型
    //   returnOrderStatus:returnOrderStatus,//获取退换货订单状态
    //   returnOrderType:returnOrderType,//获取退换货订单类型
    //   returnWayEnum:returnWayEnum,//商品返回方式
    //   getDay:getDay,
      formErrorInfo:formErrorInfo,
      successTip:successTip,
      errorTip:errorTip
    }
    Vue.prototype.common=common;

    }
}
